﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mbs.Collections;

namespace Mbs.Modularity
{
    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false)]
    public class AddInAttribute:Attribute
    {
        internal readonly IPropertySet Properties = new PropertySet(StringComparer.InvariantCultureIgnoreCase);

        /// <summary>
        /// 插件名称
        /// </summary>
        public string Name
        {
            get { return Properties.Get<string>("Name"); }
            set { Properties.Set("Name", value); }
        }


        /// <summary>
        /// 插件作者
        /// </summary>
        public string Author
        {
            get { return Properties.Get<string>("Author"); }
            set { Properties.Set("Author", value); }
        }


        /// <summary>
        /// 版权
        /// </summary>
        public string Copyright
        {
            get { return Properties.Get<string>("Copyright"); }
            set { Properties.Set("Copyright", value); }
        }


        /// <summary>
        /// 描述
        /// </summary>
        public string Description
        {
            get { return Properties.Get<string>("Description"); }
            set { Properties.Set("Description", value); }
        }


        /// <summary>
        /// Url
        /// </summary>
        public string Url
        {
            get { return Properties.Get<string>("Url"); }
            set { Properties.Set("Url", value); }
        }


        /// <summary>
        /// 是否是系统插件
        /// </summary>
        /// <remarks>
        /// 如果返回值是false，那么是系统插件，否则不是
        /// </remarks>
        public bool HideInManager
        {
            get { return Properties.Get<bool>("HideInManager"); }
            set { Properties.Set("HideInManager", value); }
        }

        /// <summary>
        /// 是否可用
        /// </summary>
        public bool Enabled
        {
            get { return Properties.Get<bool>("Enabled"); }
            set { Properties.Set("Enabled", value); }
        }

        /// <summary>
        /// 
        /// </summary>
        public Type AddInActivator
        {
            get { return Properties.Get<Type>("AddInActivator"); }
            set { Properties.Set("AddInActivator", value); }
        }

        public bool IsAsyncLoad
        {
            get { return Properties.Get<bool>("IsAsyncLoad"); }
            set { Properties.Set("IsAsyncLoad", value); }
        }

        public string[] Roles
        {
            get { return Properties.Get<string[]>("Roles"); }
            set { Properties.Set("Roles", value); }
        }



    }
}
